import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:dailypayagent/config/router_manger.dart';
import 'package:dailypayagent/ui/view/square_view.dart';

class OperationPage extends StatefulWidget {
  @override
  OperationPageState createState() => new OperationPageState();
}

class Coordinate {
  final double cx;
  final double cy;
  Coordinate({this.cx, this.cy});
}

getDate() {
  List data = new List();
  data.add(236);
  data.add(219);
  data.add(156);
  data.add(128);
  data.add(99);
  return data;
}

class OperationPageState extends State<OperationPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          centerTitle: true,
          automaticallyImplyLeading: false,
          title: Text('运营工具'),
        ),
        body: ListView(
          children: <Widget>[
            Container(
              margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
              color: Colors.white,
              padding: const EdgeInsets.all(10),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Text(
                    '商户转化漏斗',
                    style: TextStyle(color: Colors.black, fontSize: 18),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  CustomPaint(
                    painter: SquareViewPainter(context, getDate()),
                    size: Size(360, 210),
                  )
                ],
              ),
            ),
            Material(
                color: Theme.of(context).cardColor,
                child: ListTile(
                  title: Text('交易分析'),
                  onTap: () {
                    Navigator.of(context).pushNamed(RouteName.transitionList);
                  },
                  trailing: Icon(Icons.chevron_right),
                )),
            SizedBox(
              height: 1,
            ),
            Material(
                color: Theme.of(context).cardColor,
                child: ListTile(
                  title: Text('商户排名'),
                  onTap: () {
                    Navigator.of(context).pushNamed(RouteName.transitionList);
                  },
                  trailing: Icon(Icons.chevron_right),
                )),
            SizedBox(
              height: 1,
            ),
            Material(
                color: Theme.of(context).cardColor,
                child: ListTile(
                  title: Text('商户预警'),
                  onTap: () {
                    Navigator.of(context).pushNamed(RouteName.transitionList);
                  },
                  trailing: Icon(Icons.chevron_right),
                )),
            SizedBox(
              height: 10,
            ),
            Material(
                color: Theme.of(context).cardColor,
                child: ListTile(
                  title: Text('打款查询'),
                  onTap: () {
                    Navigator.of(context).pushNamed(RouteName.transitionList);
                  },
                  trailing: Icon(Icons.chevron_right),
                )),
          ],
        ));
  }
}
